﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using RN.ERP.Web.BasicService;

namespace RN.ERP.Web.Handlers
{
    /// <summary>
    /// PsnQualiHandler 的摘要说明
    /// </summary>
    public class PsnQualiHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string qualguid = context.Request["qualguid"];
            if (string.IsNullOrEmpty(qualguid) || qualguid == Guid.Empty.ToString())
            {

            }
            string rootCode = string.IsNullOrEmpty(context.Request["rootCode"]) ? "zgzs" : context.Request["rootCode"];
            string valuesAndId = string.IsNullOrEmpty(context.Request["parentId"]) ? "0@0" : context.Request["parentId"];
            if (valuesAndId == "0")
            {
                valuesAndId = "0@0";
            }
            string parentId = valuesAndId.Split(new char[] { '@' })[1];
            string proStr = null;
            BasicServiceClient client = new BasicServiceClient();
            proStr = client.GetQualitiesDic(rootCode, parentId);
            context.Response.ContentType = "text/plain";
            context.Response.Write(proStr);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}